package com.yolib.sanyi;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class DiscoverActivity extends Activity implements OnClickListener{

	private ImageView mBack;
	private ImageView mScene;
	private ImageView mWood;
	private ImageView mFood;
	private ImageView mSleep;
	private ImageView mDIY;
	private ImageView mGift;
	private ImageView mMaster;


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_discover);

		mBack	  = (ImageView) findViewById(R.id.BackImageView);
		mScene	  = (ImageView) findViewById(R.id.discover_scene);
		mWood	  = (ImageView) findViewById(R.id.discover_wood);
		mFood	  = (ImageView) findViewById(R.id.discover_food);
		mSleep	  = (ImageView) findViewById(R.id.discover_sleep);
		mDIY	  = (ImageView) findViewById(R.id.discover_diy);
		mGift	  = (ImageView) findViewById(R.id.discover_gift);
		mMaster	  = (ImageView) findViewById(R.id.discover_master);

		mBack.setOnClickListener(this);
		mScene.setOnClickListener(this);
		mWood.setOnClickListener(this);
		mFood.setOnClickListener(this);
		mSleep.setOnClickListener(this);
		mDIY.setOnClickListener(this);
		mGift.setOnClickListener(this);
		mMaster.setOnClickListener(this);

	}


	@Override
	public void onClick(View v) {

		if(v.getId() == R.id.BackImageView) {
			finish();
			overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);	
		}
		else {
			Intent discoverIntent = new Intent(DiscoverActivity.this, DiscoverListActivity.class);
			switch (v.getId()) {
			case R.id.discover_scene:
				discoverIntent.putExtra("title", "經典景點");
				discoverIntent.putExtra("id", "1");
				break;
			case R.id.discover_wood:
				discoverIntent.putExtra("title", "精采木藝");
				discoverIntent.putExtra("id", "2");
				break;
			case R.id.discover_food:
				discoverIntent.putExtra("title", "山城美食");
				discoverIntent.putExtra("id", "3");
				break;
			case R.id.discover_sleep:
				discoverIntent.putExtra("title", "山居民宿");
				discoverIntent.putExtra("id", "4");
				break;
			case R.id.discover_diy:
				discoverIntent.putExtra("title", "手作體驗");
				discoverIntent.putExtra("id", "5");
				break;
			case R.id.discover_gift:
				discoverIntent.putExtra("title", "伴手好禮");
				discoverIntent.putExtra("id", "6");
				break;
			case R.id.discover_master:
				discoverIntent.putExtra("title", "創作大師");
				discoverIntent.putExtra("id", "7");
				break;
			}
			DiscoverActivity.this.startActivity(discoverIntent);
			overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
		}
	}



}
